/*
 * PackageItemResource.h
 *
 *  Created on: 2014. 2. 27.
 *      Author: the2
 */

#ifndef PACKAGEITEMRESOURCE_H_
#define PACKAGEITEMRESOURCE_H_

#include <map>

namespace ProjectZ { namespace NResource {

class PackageItemData
{
public:
	struct Flyweight
	{
		Flyweight()
		: _ITEM1_TID(-1), _ITEM1_COUNT(-1),
		  _ITEM2_TID(-1), _ITEM2_COUNT(-1),
		  _ITEM3_TID(-1), _ITEM3_COUNT(-1),
		  _ITEM4_TID(-1), _ITEM4_COUNT(-1) {}
		int _ITEM1_TID;
		int _ITEM1_COUNT;
		int _ITEM2_TID;
		int _ITEM2_COUNT;
		int _ITEM3_TID;
		int _ITEM3_COUNT;
		int _ITEM4_TID;
		int _ITEM4_COUNT;
	};

public:
	PackageItemData() {};
	virtual ~PackageItemData();

	bool LoadResource(int company, int saleCode);
	Flyweight * GetFly(int packageIdx);

private:
	void Clear();

private:
	typedef std::map<int, Flyweight *>	DATATREE;
	DATATREE clsFlyTree;
};

class PackageItemResource {
public:
	PackageItemResource();
	virtual ~PackageItemResource();

	bool LoadResource();
	PackageItemData::Flyweight * GetFly(int company, int saleCode, int packageIdx);

private:
	PackageItemData * pPackageItemAD;
	PackageItemData * pPackageItemIOS;
};

} /* namespace NResource */ } /* namespace ProjectZ */

#endif /* PACKAGEITEMRESOURCE_H_ */
